<?php
//=======================================
//###################################
// Kayako Web Solutions
//
// Source Copyright 2001-2004 Kayako Web Solutions
// Unauthorized reproduction is not allowed
// License Number: $%LICENSE%$
// $Author: vshoor $ ($Date: 2005/08/07 05:20:29 $)
// $RCSfile: global_systemchecks.php,v $ : $Revision: 1.5.66 $ 
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
//###################################
//=======================================


if (!defined("INSWIFT")) {
	trigger_error("Unable to process $PHP_SELF", E_USER_ERROR);
}

displayStatus("Checking to see if ./cache directory is writable", is_writable("./cache"), "./cache is not writable, please change permissions as mentioned in manual");
displayStatus("Checking to see if ./files directory is writable", is_writable("./files"), "./files is not writable, please change permissions as mentioned in manual");

$minimumversion = "4.3.0";
$minimummysqlversion = "3.23.58";

// ======= Version Check =======
$phpversionresult = version_compare(phpversion(), $minimumversion);

if ($phpversionresult == -1)
{
	$versionresult = false;
} else {
	$versionresult = true;
}
displayStatus("Checking PHP Version (Minimum Requirement: ". $minimumversion .")", $versionresult, "Current PHP Version is older than ". $minimumversion .". ".SWIFTPRODUCT." will not work with PHP versions older than ".$minimumversion);

// ======= Short Tags =======
if (ini_get("short_open_tag") != "1")
{
	$shorttags = false;
} else {
	$shorttags = true;
}

displayStatus("Checking status of Short PHP Tags", $shorttags, "Short Tags are disabled under php.ini, Please change short_open_tag to 'On' to continue");

// ======= File Uploads =======
if (ini_get("file_uploads") != "1")
{
	$fileuploads = false;
} else {
	$fileuploads = true;
}

displayStatus("Checking for File Upload Status", $fileuploads, "File Uploads are disabled, You will not be able to upload any files unless you enable this setting under php.ini (file_uploads)", true);

// ======= Upload Max Size =======
$uploadsize = ini_get("upload_max_filesize");
displayValue("Checking Max Upload Limit", iif(empty($uploadsize), "Not Specified", $uploadsize), "Change upload_max_filesize in php.ini to increase the max size of file uploads");

// ======= Safe Mode =======
$safemode = ini_get("safe_mode");
displayValue("Checking for PHP Safe Mode", iif(empty($safemode), "Off", "On"));

// ======= MySQL Versions =======
$ismysqlsetup = extension_loaded("mysql");
if (!$ismysqlsetup)
{
	$mysqlsetupstatus = "<font color='red'>MySQL extension is not loaded with your PHP, Please recompile your PHP with MySQL Support. For more information, please refer to the php manual</font>";
}
displayValue("Checking for MySQL", iif($ismysqlsetup, "<font color='orange'>INSTALLED</font>", "<font color='red'>FAILED</font>"), $mysqlsetupstatus);
if (!$ismysqlsetup)
{
	displayFooter();
	exit;
}

/*$mysqlversion = mysql_get_server_info();
$mysqlversionresult = version_compare($mysqlversion, $minimummysqlversion);

if ($mysqlversionresult == -1)
{
	$mysqlstatus = "<font color='red'>Current MySQL Version is older than ". $minimummysqlversion .". ".SWIFTPRODUCT." will not work with MySQL versions older than ".$minimummysqlversion."</font>";
	$versionresult = false;
} else {
	$versionresult = true;
}
displayValue("Checking MySQL Version (Minimum Requirement: ". $minimummysqlversion .")", $mysqlversion, $mysqlstatus);
if (!$versionresult)
{
	$_SWIFT["setupfailed"] = true;
}*/
?>